home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group02b.txt / 000084_icon-group-sender_Wed Oct 23 08:03:38 2002.msg < prev    next >
Internet Message Format  |  2003-01-02  |  1KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g9NF3IM22344
  4.     for icon-group-addresses; Wed, 23 Oct 2002 08:03:19 -0700 (MST)
  5. Message-Id: <200210231503.g9NF3IM22344@baskerville.CS.Arizona.EDU>
  6. From: "Paul W. Abrahams" <abrahams@acm.org>
  7. To: icon-group@cs.arizona.edu
  8. Subject: The "variable" function and records
  9. Date: Tue, 22 Oct 2002 19:46:01 -0400
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11. Status: RO
  12.  
  13. I've been trying to write an Icon version of the COBOL "move corresponding" 
  14. facility (also known in PL/I as "by name assignment").    However, I can't 
  15. figure out how to use the "variable" function to assign something to a record 
  16. component.   Here's a test case:
  17.  
  18. #!/usr/bin/env icon
  19.  
  20. record r1(a,b,c,d)
  21.  
  22. procedure main()
  23. local x1
  24. x1:=r1("one","two","three","four")
  25. variable(name(x1.a)):="pete"
  26. write(name(x1.a),":",image(x1.a),":",x1.a)
  27.  
  28. end
  29.  
  30.  
  31. What I get is:
  32.  
  33. r1.a:"one":one
  34.  
  35. What I'm striving for is to be able to assign to the "x" field of a record R, 
  36. where "x" is a string-valued variable.   Is there a way to do that?
  37.  
  38. Paul
  39.